<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link href="skin/content_item.css" rel="stylesheet" />
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/config.js"></script>
</head>
<body ontouchstart>
<div id="main"></div>
</body>
<script type="text/javascript">
	zy_init();
	var page = 1;
	function ok(msg){
		uexWindow.toast("0","5",msg,1000);
		GetMain(-1);
	}
	
	function fontSize(z){
        if(z==0){
			$$('content').style.fontSize = '1.0625em';
		}
		if(z==1){
			$$('content').style.fontSize = '1rem';
		}
		if(z==2){
			$$('content').style.fontSize = '2rem';
		}
		if(z==3){
			$$('content').style.fontSize = '3rem';
		}
	}
	
	function GetMain(t){
		if (t == -1) {
			$$('main').className = 'loading';
			page = 1;
		}
		var url= app_api+'&a=show&id='+localStorage['news_id']+'&catid='+localStorage['news_catid'];
		uexXmlHttpMgr.open(t,'get',url,"8000");
		uexXmlHttpMgr.send(t);
	}
	
	function comment(){
		var url= app_api+'&a=commentlist&id='+localStorage['news_id']+'&catid='+localStorage['news_catid']+'&page='+page;
		uexXmlHttpMgr.open(1,'get',url,"8000");
		uexXmlHttpMgr.send(1);
	}

	window.uexOnload = function(type){
		if (!type) {
			uexWindow.setBounce("1");
			uexWindow.setBounceParams("0",'{"textColor":"#666","levelText":"","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
	　　　　	uexWindow.setBounceParams("1",'{"textColor":"#666","levelText":"","pullToReloadText":"上拉加载更多","releaseToReloadText":"释放加载","loadingText":"加载中，请稍等"}');
	　　　　uexWindow.showBounceView("0","#f3f3f3","1");
	　　　　uexWindow.notifyBounceEvent("0","1");
			uexWindow.showBounceView("1","#f3f3f3","1");
　　　　	uexWindow.notifyBounceEvent("1","1");
			uexWindow.onBounceStateChange=function(t,s){
				if(s=="2"){
					if(t=="0"){
						page =1;
						GetMain(0);
					}else if(t=="1"){
						comment();						
					}
	　　　　　　}
	　　　　}

			uexXmlHttpMgr.onData = function(opId, status, data){
				uexXmlHttpMgr.close(opId);
				uexWindow.resetBounceView(opId);
				if(status==1){
					data=JSON.parse(data);
					uexWindow.setBounceParams("0",'{"imagePath":"res://loading.png","textColor":"#666","levelText":"上次更新：'+Now()+'","pullToReloadText":"拖动刷新","releaseToReloadText":"释放刷新","loadingText":"加载中，请稍等"}');
					if(opId<1){
						$$('main').className='';			
						var News=data['data'];
						if(News['id']>=0){
							localStorage['p_title']=News['title'];
							localStorage['p_url']= News['url'];
							localStorage['p_type']= 'news_show';
							localStorage['p_catid'] = localStorage['news_catid'];
				            localStorage['p_id'] = localStorage['news_id'];
							
							var bodyHtml = '';
							bodyHtml='<header style=" background-color:'+News['color']+'">'+
				    				 '<div class="title">'+News['title']+'</div>'+
				    				 '<div class="time">更新时间：'+News['uptime']+'　浏览量：'+News['hits']+'</div>'+
				    				 '</header>'+
				    			     '<section id="content">'+News['content'];						 
						    if(News['source']!=''){
								bodyHtml+='<div id="source">来自：<span>'+News['source']+'</span><div>'; 
						    }
						    bodyHtml +='</section>';
							
							bodyHtml+='<footer><h3 class="h3">最新评论</h3><div id="comment"></div></footer>';
							$$('main').innerHTML=bodyHtml;
							comment();
							
						}else{
							uexWindow.alert('','资讯不存在','关闭');					
							uexWindow.evaluateScript('news_show',0,'uexWindow.close(1)');
						}
					
					}else if(opId==1){
						if(data['status']=='OK'){
							for(k in data['data']){
								var div = document.createElement("div");
								div.className='item';
								var html ='';
								var avatar = ''
								if(data['data'][k]['avatar']!=''){
									avatar = '<img src="'+data['data'][k]['avatar']+'">'
								}
								html +='<div class="avatar" >'+avatar+'</div>'+
								       '   <div class="talkcontent">'+
									   '   	   <h3>'+data['data'][k]['nick']+'</h3>'+
									   '       <div class="date">'+data['data'][k]['addtime']+'</div>'+
									   '       <p>'+data['data'][k]['content']+'</p>'+
									   '   </div>'+
				    				   '</div>';
								div.innerHTML = html;
								$$('comment').appendChild(div);
							}
						}
						page++;
					}
				
				}else if(status==-1){
					$$('main').className='errer';
					uexWindow.toast("0","5",'加载失败',1000);					
				}
			}
			
			GetMain(-1);
		}
	}
	

	
	</script>
</html>